<div class="form">
	<?php $form=$this->beginWidget('CActiveForm', array(
		'id'=>'client-form',
		'enableAjaxValidation'=>false,
	)); ?>
	<?php echo $form->errorSummary($model); ?>
	<!-- La balise valid est initialisée à 0 lors de la crétion d'un client. Elle sera affectée à la valeur 1 une fois le mail de confirmation accepté. -->
	<?php echo $form->hiddenField($model,'valid',array('value'=>'1','size'=>1,'maxlength'=>1)); ?>
	<?php echo $form->hiddenField($model,'id_user',array('value'=>Yii::app()->user->id,'size'=>1,'maxlength'=>1)); ?>
	<table class="table_form_inscription">
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'civilite'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><table class="champs_civilite"><tr><td><?php echo $form->radioButtonList($model,'civilite',array('M.'=>'M.','Mme'=>'Mme','Mlle'=>'Mlle'),array('separator'=>'</td><td>')); ?></td></tr></table></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'civilite'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'nom'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->textField($model,'nom',array('size'=>32,'maxlength'=>32)); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'nom'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'prenom'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->textField($model,'prenom',array('size'=>32,'maxlength'=>32)); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'prenom'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'dateDeNaissance'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->textField($model,'dateDeNaissance',array('size'=>10,'maxlength'=>10)); ?> <span class="libelleFormatDate">(Format : JJ/MM/AAAA)</span></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'dateDeNaissance'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription" valign="top"><?php echo $form->labelEx($model,'adresse'); ?></td>
			<td class="separateur" valign=top>:</td>
			<td class="champ_form_inscription"><?php echo $form->textarea($model,'adresse',array('size'=>60,'maxlength'=>500)); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'adresse'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'codePostal'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->textField($model,'codePostal',array('size'=>5,'maxlength'=>5)); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'codePostal'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'ville'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription">
				<?php 
				if(count($form->error($model,'ville'))!=0 && $form->error($model,'ville')!= "") {
					$classErreurVille = 'error';
				}
				else {
					$classErreurVille = '';
				}
				$this->widget('zii.widgets.jui.CJuiAutoComplete',
					array(
						//name of the html field that will be generated
						'name'=>CHtml::activeName($model,'ville'),
						'value'=>$model->ville,
						'source'=>$this->createUrl('client/autocompleteVille'),
						'options'=>array(
					        'minLength'=>'2',
					    ), 
					    'htmlOptions'=> array(
					    	'size'=>'32',
					    	'class'=> $classErreurVille,
					    ),
					));
			    ?>
			</td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'ville'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'pays'); ?></td>
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->dropDownList($model,'pays',CHtml::listData($listePays, 'nom', 'nom')); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'pays'); ?></td>
		</tr>
		<tr>
			<td class="libelle_form_inscription"><?php echo $form->labelEx($model,'tel'); ?></td>	
			<td class="separateur">:</td>
			<td class="champ_form_inscription"><?php echo $form->textField($model,'tel',array('size'=>20,'maxlength'=>20)); ?></td>
			<td class="erreur_form_inscription"><?php echo $form->error($model,'tel'); ?></td>
		</tr>
		<tr>
			<td class="bouton_form_inscription" colspan=4>
				<table>
					<tr>
						<td><?php echo Chtml::link(CHtml::button('Retour'),$this->createUrl("/panier")); ?></td>
						<td><?php echo CHtml::submitButton($model->isNewRecord ? 'Suivant' : 'Suivant'); ?></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<?php $this->endWidget(); ?>
</div><!-- form -->